<template>
  <div class="movieList">
    <router-link
      :to="{ path: '/movieDetail', query: { id: id } }"
      class="goods-list-link"
    >
      {{ movieName }} - {{ movieTimeShow }}
    </router-link>
  </div>
</template>

<script>
export default {
  props: ['id', 'movieName', 'movieTime'],
  data() {
    return {
      movieTimeShow: ''
    }
  },
  created() {
    // toLocaleString() 方法可根据本地时间把 Date 对象转换为字符串，并返回结果
    this.movieTimeShow = new Date(parseInt(this.movieTime))
      .toLocaleString()
      .replace(/:\d{1,2}$/, '')
  }
}
</script>

<style lang="css" scoped>
.movieList {
  padding: 5px;
  border-bottom: 1px dashed #ababab;
}
</style>
